package com.yuw.control.ajax;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet("/AjaxDemoControl")
public class AjaxDemoControl extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 从request对象获取表单数据
		String struid = request.getParameter("uid");
		System.out.println("ajax获取的参数：uid="+struid);
		// 服务器通过网络通信的方式进行ajax的响应，也就是发送客户端response内容
		// 获取response中的流操作对象PrintWriter
		PrintWriter pw = response.getWriter();
		// 写出内容到浏览器客户端
		pw.write("ok,HelloWorld");
		pw.flush();
		//pw.close(); //?
	}

}
